<%@ page import="com.mysql.fabric.xmlrpc.base.Data" %><%--
  Created by IntelliJ IDEA.
  User: liaozhipeng
  Date: 2024/8/29
  Time: 14:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge"/>
    <title>韩顺平教育-家居网购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <link rel="stylesheet" href="../../assets/css/vendor/vendor.min.css"/>
    <link rel="stylesheet" href="../../assets/css/plugins/plugins.min.css"/>
    <link rel="stylesheet" href="../../assets/css/style.min.css"/>
    <script type="text/javascript" src="../../script/jquery-3.6.0.min.js"></script>
    <script>
        $(function () {
            $("#username").blur(function () {
                var val = $(this).val();
                $.getJSON(
                    "/Web/javaWeb/MemberServlet?action=isUser&username="+val,
                    function (date,statue,xhr){
                      console.log("log",date.isExist)
                        if (date.isExist){
                            $("span.errorMsg").text("用户不可用")
                        }else {
                            $("span.errorMsg").text("用户可用")
                        }
                    },

                )
            })
            $("#code").blur(function (){
                var val = $(this).val();
                $.getJSON(
                    "/Web/javaWeb/MemberServlet?action=isCode&codeNumber="+val,
                    function (date,statue,xhr){
                        console.log("log",date.isExist)
                        if (date.isExist){
                            $("#WordCode").text("验证码可用")
                        }else {
                            $("#WordCode").text("验证码不可用")
                        }
                    },

                )

            })
            //模拟一个点击事件
            if ("${requestScope.active}" == "Register") {
                $("#Register").addClass("active")
            } else {
                $("#login").addClass("active")
            }
            $("#sub-btn").click(function () {
                var username = $("#username").val();
                var usernamePattern = /^\w{6,10}$/;
                if (!usernamePattern.test(username)) {
                    //属性过滤器
                    $("span[class ='errorMsg']").text("用户名不对")
                    return false
                }
                var password = $("#password").val();
                var passwordPattern = /^\w{6,10}$/;
                if (!passwordPattern.test(password)) {
                    //基本过滤器
                    $("span.errorMsg").text("密码不对")
                    return false
                }
                var repwd = $("#repwd").val();
                if (repwd != password) {
                    $("span.errorMsg").text("输入两次密码不相同")
                    return false;
                }
                //验证邮箱
                var email = $("email").val();
                var conText = $("#code").val();
                conText = $.trim(conText)
                if (conText == null || conText == "") {
                    $("span.errorMsg").text("验证码为空")
                    return false;
                }
            })
            $("#imgCode").click(function () {
                this.src = "<%=request.getContextPath()%>" + "/KaptchaServlet" + "?action=" + new Date();
            })
        })
//给用户绑定一个事件



    </script>


    <%
        String word = "";
        String username = request.getParameter("user-name");
        String passWord = request.getParameter("user-password");
        if (request.getAttribute("isTrue") == null && !"".equals(username) && !"".equals(passWord)) {
            word = "";
        } else {
            word = "用户名或密码错误";
        }
    %>


</head>
<body>
<!-- Header Area start  -->
<div class="header section">
    <!-- Header Top Message Start -->
    <!-- Header Top  End -->
    <!-- Header Bottom  Start -->
    <div class="header-bottom d-none d-lg-block">
        <div class="container position-relative">
            <div class="row align-self-center">
                <!-- Header Logo Start -->

                <div class="col-auto align-self-center">
                    <div class="header-logo">
                        <a href="../../index.html"><img src="../../assets/images/logo/logo.png" alt="Site Logo"/></a>
                    </div>
                </div>
                <!-- Header Logo End -->

            </div>
        </div>
    </div>
    <!-- Header Bottom  Start 手机端的header -->
    <div class="header-bottom d-lg-none sticky-nav bg-white">
        <div class="container position-relative">
            <div class="row align-self-center">
                <!-- Header Logo Start -->
                <div class="col-auto align-self-center">
                    <div class="header-logo">
                        <a href="index.html"><img width="280px" src="../../assets/images/logo/logo.png"
                                                  alt="Site Logo"/></a>
                    </div>
                </div>
                <!-- Header Logo End -->
            </div>
        </div>
    </div>
    <!-- Main Menu Start -->
    <div style="width: 100%;height: 50px;background-color: black"></div>
    <!-- Main Menu End -->
</div>
<!-- Header Area End  -->
<!-- login area start -->
<div class="login-register-area pt-70px pb-100px">
    <div class="container">
        <div class="row">
            <div class="col-lg-7 col-md-12 ml-auto mr-auto">
                <div class="login-register-wrapper">
                    <div class="login-register-tab-list nav">
                        <a id="login" data-bs-toggle="tab" href="#lg1">
                            <h4>会员登录</h4>
                        </a>
                        <a id="Register" data-bs-toggle="tab" href="#lg2">
                            <h4>会员注册</h4>
                        </a>
                    </div>
                    <div class="tab-content">
                        <div id="lg1" class="tab-pane active">
                            <div class="login-form-container">
                                <div class="login-register-form">
                                    <form action="/Web/javaWeb/MemberServlet" method="post">
                                        <span id="errorText"
                                              style="font-size: 18pt;font-weight: bold;float: right;color: #999999">
                                            ${requestScope.msg}

                                        </span>
                                        <input type="hidden" name="action" value="Login">
                                        <input type="text" name="user-name" value="${requestScope.username}"
                                               placeholder="Username"/>
                                        <input type="password" name="user-password" placeholder="Password"/>
                                        <div class="button-box">
                                            <div class="login-toggle-btn">
                                                <input type="checkbox"/>
                                                <a class="flote-none" href="javascript:void(0)">Remember me</a>
                                                <a href="#">Forgot Password?</a>
                                            </div>
                                            <button><span>Login</span></button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div id="lg2" class="tab-pane">
                            <div class="login-form-container">
                                <div class="login-register-form">
                                    <span class="errorMsg"
                                          style="float: right; font-weight: bold; font-size: 20pt; margin-left: 10px;"></span>
                                    <form action="/Web/javaWeb/MemberServlet" method="post">
                                        <input type="hidden" name="action" value="Register">
                                        <input type="text" id="username" name="username" placeholder="Username"/>
                                        <input type="password" id="password" name="password" placeholder="输入密码"/>
                                        <input type="password" id="repwd" name="user-password" placeholder="确认密码"/>
                                        <input name="email" id="email" placeholder="电子邮件" type="email"/>
                                        <input type="text" id="code" name="captcha" style="width: 50%"
                                               placeholder="验证码"/>　　
                                        <img alt="" id="imgCode" src="/Web//KaptchaServlet">
                                        <p id="WordCode"></p>
                                        <div class="button-box">
                                            <button id="sub-btn"><span>会员注册</span></button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- login area end -->

<!-- Footer Area Start -->
<div class="footer-area">
    <div class="footer-container">
        <div class="footer-top">
            <div class="container">
                <div class="row">
                    <!-- Start single blog -->
                    <!-- End single blog -->
                    <!-- Start single blog -->
                    <div class="col-md-6 col-sm-6 col-lg-3 mb-md-30px mb-lm-30px" data-aos="fade-up"
                         data-aos-delay="400">
                        <div class="single-wedge">
                            <h4 class="footer-herading">信息</h4>
                            <div class="footer-links">
                                <div class="footer-row">
                                    <ul class="align-items-center">
                                        <li class="li"><a class="single-link" href="about.html">关于我们</a></li>
                                        <li class="li"><a class="single-link" href="#">交货信息</a></li>
                                        <li class="li"><a class="single-link" href="privacy-policy.html">隐私与政策</a>
                                        </li>
                                        <li class="li"><a class="single-link" href="#">条款和条件</a></li>
                                        <li class="li"><a class="single-link" href="#">制造</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- End single blog -->
                    <!-- Start single blog -->
                    <div class="col-md-6 col-lg-2 col-sm-6 mb-lm-30px" data-aos="fade-up" data-aos-delay="600">
                        <div class="single-wedge">
                            <h4 class="footer-herading">我的账号</h4>
                            <div class="footer-links">
                                <div class="footer-row">
                                    <ul class="align-items-center">
                                        <li class="li"><a class="single-link" href="my-account.html">我的账号</a>
                                        </li>
                                        <li class="li"><a class="single-link" href="cart.html">我的购物车</a></li>
                                        <li class="li"><a class="single-link" href="login.html">登录</a></li>
                                        <li class="li"><a class="single-link" href="wishlist.html">感兴趣的</a></li>
                                        <li class="li"><a class="single-link" href="checkout.html">结账</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- End single blog -->
                    <!-- Start single blog -->
                    <div class="col-md-6 col-lg-3" data-aos="fade-up" data-aos-delay="800">

                    </div>
                    <!-- End single blog -->
                </div>
            </div>
        </div>
        <div class="footer-bottom">
            <div class="container">
                <div class="row flex-sm-row-reverse">
                    <div class="col-md-6 text-right">
                        <div class="payment-link">
                            <img src="#" alt="">
                        </div>
                    </div>
                    <div class="col-md-6 text-left">
                        <p class="copy-text">Copyright &copy; 2021 韩顺平教育~</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Footer Area End -->
<script src="../../assets/js/vendor/vendor.min.js"></script>
<script src="../../assets/js/plugins/plugins.min.js"></script>
<!-- Main Js -->
<script src="../../assets/js/main.js"></script>
</body>
</html>